/*
 * File      : bb_mem.h
 * This file is part of Black Bird Simulation Platform
 * Copyright 2013-2020 BB(Black Bird) Development Team.  
 * All rights reserved.
 *
 * Change Logs:
 * Date           Author       Notes
 * 2014-03-24    Holt         First Version
 */
#ifndef __BB_MEM_INCLUDE__
#define __BB_MEM_INCLUDE__
#include <stdlib.h>
#includ  <stddef.h>
#include "bb_except.h"
#include "bb_assert.h"
#include "bb_type.h"
extern const bb_except_t EXCEPT_mem_failed;
extern void *bb_mem_alloc(bb_base_long nbytes,const char*file,const bb_base line);
extern void *bb_mem_calloc(bb_base_long count,bb_base_long nbytes,const char*file,const bb_base line);
extern void bb_mem_free(void*p,const char *file,const bb_base line);
extern void *bb_mem_resize(void*p,bb_base_long nbytes,const char*file,const bb_base line);

#define BB_ALLOC(nbytes)\
	bb_mem_alloc((nbytes),__FILE__,__LINE__)
#define BB_CALLOC(count,nbytes)\
	bb_mem_calloc((count),(nbytes),__FILE__,__LINE__)
#define BB_FREE(p)\
	((void)(pp_mem_free((p),__FILE__,__LINE__),(p)=0))
#define BB_RESIZE(p,nbytes) ((p)=bb_mem_resize((p),\
	(nbytes),__FILE__,__LINE__))
#endif
#endif